<template>
	<view class="newsdetail-container">
		<Newsdetail
			:title="newsdetail.title"
			:datetime="newsdetail.datetime"
			:source="newsdetail.source"
			:img_url="newsdetail.img_url"
			:content="newsdetail.content"
		></Newsdetail>
	</view>
</template>

<script>
	import Newsdetail from '../../components/Newsdetail.vue'
	
	export default {
		data() {
			return {
				newsid: 0,
				newsdetail: {}
			}
		},
		methods: {
			async requestNewsDetail() {
				const res = await this.$myRequest({
					url: '/newsdetail',
					method: 'POST',
					data: {
						newsid: this.newsid
					}
				})
				this.newsdetail = res.data.res[0]
				console.log(this.newsdetail)
			}
		},
		onLoad(option) {
			if(option.id) {
				let id = option.id
				this.newsid = id
				this.requestNewsDetail()
			}
		},
		components: {
			Newsdetail: Newsdetail
		}
	}
</script>

<style lang="scss" scoped>

</style>
